<!--
 * @Author: shenya
 * @Date: 2023-08-24 11:46:58
 * @Description: 活动管理
-->
<template>
  <basic-container>
    <avue-crud
      ref="crud"
      v-model="form"
      :page.sync="page"
      :data="tableData"
      :table-loading="tableLoading"
      :option="tableOption"
      @on-load="getList"
      @search-change="searchChange"
      @search-reset="searchReset"
    >
    </avue-crud>
  </basic-container>
</template>
<script>
import crudMixins from '@/mixins/crud';
import { fetchList } from '@/api/entry/buz';
import { tableOption } from '@/const/crud/event/index';
export default {
  mixins: [crudMixins],
  data() {
    return {
      form: {},
      tableOption: tableOption(),
      tableData: [],
      tableLoading: false,
    };
  },
  methods: {
    // 列表查询
    getList(page, refresh) {
      if (refresh) {
        this.page.current = 1;
        this.page.currentPage = 1;
      }
      this.tableLoading = true;
      fetchList(
        Object.assign(
          {
            current: this.page.currentPage,
            size: this.page.pageSize,
          },
          this.searchForm
        )
      )
        .then((response) => {
          this.tableData = response.data.data.records;
          this.page.total = response.data.data.total;
          this.tableLoading = false;
        })
        .catch(() => {
          this.tableLoading = false;
        });
    },
  },
};
</script>
<style lang="scss" scoped>
</style>
